package cn.demomaster.quickrouter.quickview;

import java.util.ArrayList;

public class ViewCollection extends ArrayList<QuickView> {
    public void put(String tag, QuickView quickView) {
        boolean constaint = false;
        for(QuickView quickView1:this){
            String tag1 = quickView1.getTag();
            if (tag.equals(tag1)){
                constaint = true;
            }
        }
        if(!constaint) {
            this.add(quickView);
        }
    }
    public void put(QuickView quickView) {
       put(quickView.getTag(),quickView);
    }
    public QuickView getByTag(String tag) {
        for(QuickView quickView:this){
            if (tag.equals(quickView.getTag())){
                return quickView;
            }
        }
        return null;
    }
    public void removeByTag(String tag) {
        for(QuickView quickView:this){
            if (tag.equals(quickView.getTag())){
                remove(quickView);
                return;
            }
        }
    }
}
